package cn.qyj.oa.service.impl;

import org.springframework.stereotype.Service;

import cn.qyj.oa.base.DaoSupportImpl;
import cn.qyj.oa.domain.User;
import cn.qyj.oa.service.UserService;
import cn.qyj.oa.util.DigestUtils;

@Service
public class UserServiceImpl extends DaoSupportImpl<User> implements UserService {

	public User findByLoginNameAndPassword(String name, String password) {
		String password_md5 = DigestUtils.md5(password);
		return (User) getSession().createQuery(//
				"FROM User tu WHERE tu.loginName=? AND tu.password=?")//
				.setParameter(0, name).setParameter(1, password_md5)
				// ����Ψһ���
				.uniqueResult();

	}

}
